home *** CD-ROM | disk | FTP | other *** search
- #include <proto/dos.h>
- #include "App.bh"
- #include <string.h>
-
- #define mcmp( x ) strncmp( x, linebuf, strlen( x ) )
-
- Method App::LoadOpts()
- {
- BPTR fh;
- char linebuf[200];
-
- if( !(fh = Open( "BCCOptions", MODE_OLDFILE )) )
- fh = Open( "ENV:bcc/BCCOptions", MODE_OLDFILE );
-
- if( fh ) {
-
- while( FGets( fh, linebuf, 199 ) ) {
-
- if( !mcmp( "deftype" ) ) {
- if( !strncmp( "BOP", linebuf + 8, 3 ) )
- deftype->Active = 1;
- }
-
- if( !mcmp( "verbose" ) ) verbose->Active = 1;
- if( !mcmp( "noversion" ) ) noversion->Active = 1;
- if( !mcmp( "forcetrans" ) ) forcetrans->Active = 1;
-
- if( !mcmp( "incdir" ) ) {
- if( linebuf[7] == '"' && linebuf[strlen(linebuf)-1] == '"' ) {
- linebuf[strlen(linebuf)-1] = 0;
- incdir->Contents = linebuf+8;
- }
- }
-
- if( !mcmp( "tagbase" ) ) {
- tagbase->Contents = linebuf + 8;
- }
-
-
- }
-
- Close( fh );
-
- }
-
- }
-
- Method App::SaveName( char *name )
- {
-
- BPTR fh;
-
- if( !(fh = Open( name, MODE_NEWFILE )) ) {
- Printf( "Error: can not save opts file\n" );
- mreturn 0;
- }
-
- if( deftype->Active ) FPrintf( fh, "deftype BOP\n" );
- if( verbose->Active ) FPrintf( fh, "verbose\n" );
- if( noversion->Active ) FPrintf( fh, "noversion\n" );
- if( forcetrans->Active ) FPrintf( fh, "forcetrans\n" );
- if( stricmp( (char*)incdir->Contents, "ENV:bcc/" ) && stricmp( (char*)incdir->Contents, "ENV:bcc" ) )
- FPrintf( fh, "incdir \"%s\"\n", incdir->Contents );
- if( strcmp( "none", (char*)tagbase->Contents ) )
- FPrintf( fh, "tagbase %s\n", tagbase->Contents );
-
- Close( fh );
-
- }
-
- nodata Method App::SaveOpts( long default )
- {
- if( default ) {
- obj->SaveName( "ENV:bcc/BCCOptions" );
- obj->SaveName( "ENVARC:bcc/BCCOptions" );
- } else obj->SaveName( "BCCOptions" );
-
- obj->Application_ReturnID( MUIV_Application_ReturnID_Quit );
-
- }
-